package biopepa;

import java.util.ArrayList;
import java.util.HashMap;
import java.lang.*;

public class ActionEnabled {
	
	public String actionEnabledName;
	public String actionEnabledNameWithLoc;
	public NewReaction reaction;
	public int stoichiometry;
	public boolean isContinuous;
	public boolean isCalled; //in compositional def or model component
	public boolean isDisplacement;
	public HashMap<String , NewLocation> locations;
	public NewLocation location1;
	public NewLocation location2;
    public int operator;

	
    public ActionEnabled(String name, LocationAndInitial inLocation , String stoich, int op){

		actionEnabledName = name;
		actionEnabledNameWithLoc = name + "." + inLocation.location.locationName;
		reaction = null;
		stoichiometry = Integer.parseInt(stoich);
		isContinuous = false;
		isCalled = false;
		isDisplacement = false;
		locations = new HashMap<String , NewLocation> ();
		operator = op;
		locations.put(inLocation.location.locationName, inLocation.location);		
		
	}
	
	public ActionEnabled(String name , String stoich, String op){

		actionEnabledName = name;
		actionEnabledNameWithLoc = name;
		reaction = null;
		stoichiometry = Integer.parseInt(stoich);
		isContinuous = false;
		isCalled = false;
		isDisplacement = false;
		locations = new HashMap<String , NewLocation> ();
		
		if(op == "<<"){
			operator = 1;
		}
		else if(op == "(+)"){
			operator = 3;
		}
		else if(op == "(-)"){
			operator = 4;
		}
		else if(op == "(.)"){
			operator = 5;
		}
		else if(op == "->"){
			operator = 6;
		}
		else if(op == "<->"){
			operator = 7;
		}
		else{
			operator = 2;
		}
		
	}
	
	public ActionEnabled(String name, String stoich, String op , ArrayList<NewLocation> newLocations){

		actionEnabledName = name;
		actionEnabledNameWithLoc = name;
		stoichiometry = Integer.parseInt(stoich);
//		operator=op;
		isContinuous = false;
		isCalled = false;
		isDisplacement = false;
		locations = new HashMap<String , NewLocation> ();
		
		if(op == "<<"){
			operator = 1;
		}
		else if(op == "(+)"){
			operator = 3;
		}
		else if(op == "(-)"){
			operator = 4;
		}
		else if(op == "(.)"){
			operator = 5;
		}
		else if(op == "->"){
			operator = 6;
		}
		else if(op == "<->"){
			operator = 7;
		}
		else{
			operator = 2;
		}
		
		int i;
		int size = newLocations.size();
		for(i=0; i<size; i++){
			NewLocation location = newLocations.get(i);
			locations.put(location.locationName, location);
		}
		
	}
	
	public ActionEnabled(String name , String stoich, int op){
		actionEnabledName = name;
		actionEnabledNameWithLoc = name;
		stoichiometry = Integer.parseInt(stoich);
		operator=op;
		isContinuous = false;
		isCalled = false;
		isDisplacement = false;
	}
	
	public ActionEnabled(String name ){
		actionEnabledName = name;
		isDisplacement = false;
	}
	
	public String getActionEnabledName(ActionEnabled name){
		return name.actionEnabledName;
	}


}
